﻿using System;
using System.Configuration;

namespace NDBGen.Configuration
{
    public class SchemaDatabaseOutputFileElement : ProjectManagedEntryConfigurationElement, ICollectionItemElement
    {
        const String PROPNAME_GENERATOR = "generator";
        [ConfigurationProperty(PROPNAME_GENERATOR, IsKey = true, IsRequired = true)]
        public String Generator
        {
            get { return (String)this[PROPNAME_GENERATOR]; }
            set { this[PROPNAME_GENERATOR] = value; }
        }

        const String PROPNAME_SCHEMAOUTPUTTYPE = "schemaOutputType";
        [ConfigurationProperty(PROPNAME_SCHEMAOUTPUTTYPE, IsKey = true, IsRequired = true)]
        public SchemaOutputType SchemaOutputType
        {
            get { return (SchemaOutputType)this[PROPNAME_SCHEMAOUTPUTTYPE]; }
            set { this[PROPNAME_SCHEMAOUTPUTTYPE] = value; }
        }

        const String PROPNAME_PATH = "path";
        [ConfigurationProperty(PROPNAME_PATH, IsKey = true, IsRequired = true)]
        public String Path
        {
            get { return (String)this[PROPNAME_PATH]; }
            set { this[PROPNAME_PATH] = value; }
        }

        #region [ IConfigurationElement Members ]

        Object ICollectionItemElement.Key
        {
            get { return String.Format("{0}{1}->{2}", this.Generator, this.SchemaOutputType, this.Path); }
        }

        #endregion
    }
}